<?php $this->_extends('../_layouts/blank_layout'); ?>
<?php $this->_block('contents'); ?>
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.js"></script>
<link type="text/css" href="<?=Q::ini('custom_system/base_url')?>css/prettyphoto.css" rel="stylesheet" />
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.prettyphoto.js"></script>
<script type="text/javascript">
$(function(){
	$("a[rel^='pretty_photo']").prettyPhoto({theme:'facebook'});
	$("#save_btn").click(function(){
		var can_save = 1;
		if (can_save)
		{
			$("form").submit();
		}
	});
});
</script>
<h3><?=Helper_BSS_Normal::getIniOne('purchase_order_type', 'value', $purchase_order['type'], 'name')?></h3>
<form method="post" action="<?=url('Storage::DFOverseas/InfoEditSave')?>">
<table class="form_table">
<tr>
	<th>单号</th>
	<td><?=$purchase_order['number']?>
	<input type="hidden" name="purchase_order_id" value="<?=$purchase_order['id']?>" />
	</td>
	<th>经手人员</th>
	<td><?=$purchase_order['purchase_user_name']?></td>
</tr>
<tr>
	<th>日期</th>
	<td><?=$purchase_order['purchase_time']?></td>
	<th>实际总价</th>
	<td><?=sprintf('%.2f', $purchase_order['actual_amount'])?></td>
</tr>
<tr>
	<th>仓库</th>
	<td><?=$purchase_order['warehouse_name']?></td>
	<th>结款类型</th>
	<td><?=Helper_BSS_Normal::getIniOne('purchase_order_payment_type','value',$purchase_order['payment_type'],'name')?></td>
</tr>
<tr>
	<th>备注</th>
	<td colspan="3"><textarea rows="3" cols="70" disabled="disabled"><?=$purchase_order['notes']?></textarea></td>
</tr>
</table>
<table width="100%" class="list_table">
<tr>
	<th width="100">图片</th>
	<th width="50">产品编号</th>
	<th width="180">产品名称</th>
	<th width="40">预计数</th>
	<th width="40">实际数</th>
	<th width="50">当前库存</th>
	<th width="70">架位</th>
	<th width="40">产品特点</th>
	<th width="100">包材</th>
	<th width="60">标签贴</th>
	<th width="60">重量G</th>
	<th width="60">申报价值$</th>
	<th width="80">申报名称CN</th>
	<th width="80">申报名称EN</th>
	<th>备注</th>
</tr>
<?foreach ($item as $i):?>
<tr>
	<td>
		<?if ($i['pic_url']):?>
			<?$pretty_photo_number = 0;?>
			<?foreach ($i['pic_url'] as $ip):?>
			<a rel="pretty_photo[<?=$i['id']?>]" href="<?=$ip?>"><?if(!$pretty_photo_number):?><img src="<?=$i['pic_url'][0]?>" height="100" /><?endif;?></a>
			<?$pretty_photo_number = 1;?>
			<?endforeach;?>
		<?endif;?>
	</td>
	<td>
		<?=$i['product_number']?>
		<input type="hidden" name="product_number" value="<?=$i['product_number']?>" />
	</td>
	<td align="left"><?=$i['product_name']?></td>
	<td align="left"><?=intval($i['budget_quantity'])?></td>
	<td align="left">
		<?=$i['actual_quantity'];?>
		<input type="hidden" name="item[<?=$i['id']?>][product_warehouse_id]" value="<?=$i['product_warehouse_id']?>" />
		<input type="hidden" value="<?=$i['budget_quantity']?>" />
	</td>
	<td><?=$i['product_warehouse_actual_quantity']?></td>
	<td style="<?if (empty($i['shelf_position'])):?>background-color: #B6DFB5;<?endif;?>">
		<input type="text" name="item[<?=$i['id']?>][shelf_position]" value="<?=trim($i['shelf_position'])?>" size="9" style="<?if (empty($i['shelf_position'])):?>background-color: #B6DFB5;<?endif;?>" />
	</td>
	<td>
		<input type="text" name="item[<?=$i['id']?>][product_feature]" value="<?=trim($i['product_feature'])?>" size="6" />
	</td>
	<td style="<?if(empty($i['material_number'])):?>background-color: #B6DFB5;<?endif;?>">
		<select style="<?if(empty($i['material_number'])):?>background-color: #B6DFB5; border: none;<?endif;?>" class="material" name="item[<?=$i['id']?>][product_material_id]">
			<option value=0 ></option>
			<?foreach ($material as $m):?>
			<option value="<?=$m['id']?>" <?if($m['id']==$i['product_material_id']):?>selected="selected"<?endif;?>><?=$m['number']?> - <?=$m['name']?></option>
			<?endforeach;?>
		</select>
	</td>
	<td>
		<select name="item[<?=$i['id']?>][tag]" class="tag">
			<?foreach (Q::ini('custom_flag/product_warehouse_tag') as $t):?>
			<option value="<?=$t['value']?>" <?if ($i['tag'] == $t['value']) echo "selected='selected'"?>><?=$t['name']?></option>
			<?endforeach;?>
		</select>
	</td>
	<td style="<?if(!floatval($i['weight'])):?>background-color: #B6DFB5;<?endif;?>"><?=$i['weight']?></td>
	<td style="<?if(!floatval($i['declared_value'])):?>background-color: #B6DFB5;<?endif;?>"><?=$i['declared_value']?></td>
	<td style="<?if(!trim($i['declared_name_cn'])):?>background-color: #B6DFB5;<?endif;?>"><?=$i['declared_name_cn']?></td>
	<td style="<?if(!trim($i['declared_name_en'])):?>background-color: #B6DFB5;<?endif;?>"><?=$i['declared_name_en']?></td>
	<td><?=$i['notes']?></td>
</tr>
<?endforeach;?>
</table>
<br />
<div align="center"><input type="button" class="button" id="save_btn" value="保存" /><input type="hidden" name="<?=Q::ini('unique_token_name');?>" value="<?=Helper_BSS_Normal::genToken();?>"/></div>
</form>
<?php $this->_endblock();?>